<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <%
        pageContext.setAttribute("APP_PATH", request.getContextPath());
    %>
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <style>
        .parent {
            width: 100%;
            height: 100%;
        }

        .child1 {
            width: 100%;
            height: 15%;
            background-color: #ffffff;
        }

        .child2 {
            width: 100%;
            height: 60%;
            background-color: #fffde3;
        }

        .child3 {
            width: 100%;
            height: 15%;

        }

        .child4 {
            width: 90%;
            height: 70%;

        }
    </style>
</head>
<body>
<jsp:include page="admin_header.jsp"/>
<div class="container ">

    <div class="child1">
        <div class="row">
            <div class="col-md-12"><br/></div>
            <div class="col-md-12"><br/></div>
            <div class="col-md-12"><br/></div>

            <form class="form-horizontal" id="add" method="post">

                <div class="form-group">
                    <label class="col-sm-1 control-label">有效期至：</label>

                    <div class="col-sm-10">
                        <input type="text" name="end" class="form-control" id="end">
                    </div>

                </div>

                <div class="form-group">
                    <label class="col-sm-1 control-label">消息：</label>

                    <div class="col-sm-10">
                        <input type="text" name="message" class="form-control" id="message">
                        <br>
                        <button class="btn btn-success btn-lg " id="sub-btn">发送</button>
                    </div>
                </div>
            </form>

            <script>
                $("#sub-btn").click(function () {
                    $.ajax({
                        url: "${APP_PATH}/sendMessageToAll",
                        type: "POST",
                        data: $("#add").serialize(),
                        success: function (result) {
                            alert(result.message);
                        }
                    });
                });
            </script>

        </div>
    </div>


    <div class="child3">
        <jsp:include page="admin_foot.jsp"/>
    </div>
</div>

</body>
</html>
